{include file="public/header" /}
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>{$Think.lang.fuwu_personal}</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
        <form id="form" method="post" name="form1">
            <input type="hidden" name="id" value="{$data.id}" id="id"/>
            <input type="hidden" name="admin_id" value="{$data.admin_id}" id="admin_id"/>
            <table class="ds-default-table">
                <tbody>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_code1}:</td>
                    <td class="vatop rowform"><input type="text" value="{$data.prevcode}" name="prevcode" id="prevcode" class="txt" readonly="readonly"></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_skillid}:</td>
                    <td class="vatop rowform">
                        <select name="skillid" id="skillid">
                            {foreach name='skillArr' item='v'}
                            {if $data.skillid== $v.id}
                            <option value="{$v.id}"  selected >{$v.name}</option>
                           {/if}
                            {/foreach}
                        </select>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_phone}:</td>
                    <td class="vatop rowform"><input type="text" value="{$data.phone}" name="phone" id="phone" class="txt"  readonly="readonly"></td>
                    <td class="vatop tips"></td>
                </tr>
                <!--<tr class="noborder">-->
                    <!--<td class="required w120"><label class="validation">{$Think.lang.fuwu_personal_password}:</label></td>-->
                    <!--<td class="vatop rowform"><input type="password" value="{$data.password}" name="password" id="password" class="txt"></td>-->
                    <!--<td class="vatop tips"></td>-->
                <!--</tr>-->
                <!--<tr class="noborder">-->
                    <!--<td class="required w120"><label class="validation">{$Think.lang.fuwu_personal_password_queren}:</label></td>-->
                    <!--<td class="vatop rowform"><input type="password" value="{$data.password}" name="quren_password" id="quren_password" class="txt"></td>-->
                    <!--<td class="vatop tips"></td>-->
                <!--</tr>-->
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_avtar}:</td>
                    <td class="vatop rowform">
                        {if $data.avtar }
                        <img src="{$data.avtar}"  width="150"/>
                        <span>
                        <a href="javascript:dsLayerOpen('{:url('Fupersonalshiming/datu',['img'=>$data.avtar])}','原图')">查看原图
                        </a></span>
                        {/if}
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_sex}:</td>
                    <td class="vatop rowform">
                        {if $data.sex == 0}
                        <input type="radio" value="0" name="sex" checked>{$Think.lang.fuwu_personal_sex0}
                        {elseif $data.sex == 1}
                        <input type="radio" value="1" name="sex" checked>{$Think.lang.fuwu_personal_sex1}&nbsp;
                        {elseif $data.sex == 2}&nbsp;
                        <input type="radio" value="2" name="sex" checked>{$Think.lang.fuwu_personal_sex2}&nbsp;
                        {/if}
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_birthday}:</td>
                    <td class="vatop rowform">
                        <input class="txt" type="text" value="{$data.birthday}" readonly="readonly">
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_address}:</td>
                    <td class="vatop">
                        <input class="txt" type="text" value="{$data.address}" readonly="readonly" style="width:250px;">
                        <!--<input type="hidden" name="address" id="address" value="{$data.address}"/>-->
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_kouhao}:</td>
                    <td class="vatop rowform">
                        <textarea name="kouhao" id="kouhao" class="txt" readonly="readonly" >{$data.kouhao}
                        </textarea>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_name}:</td>
                    <td class="vatop rowform"><input type="text" value="{$data.name}" name="name" id="name" class="txt" readonly="readonly" ></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_idcard}:</td>
                    <td class="vatop rowform"><input type="text" value="{$data.idcard}" name="idcard" id="idcard" class="txt" readonly="readonly" ></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_cardimgz}:</td>
                    <td class="vatop rowform">
                        <img src="{$data.cardImgZ}" width="150"/>
                        <!--<input  name="file" id='upload_img1'  type="file">-->
                        <input type="hidden" name="cardImgZ" id='cardImgZ' value="{$data.cardImgZ}" readonly="readonly" >
                        <span>
                        <a href="javascript:dsLayerOpen('{:url('Fupersonalshiming/datu',['img'=>$data.cardImgZ])}','原图')">查看原图
                        </a></span>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_cardimgf}:</td>
                    <td class="vatop rowform">
                        <img src="{$data.cardImgF}" width="150"/>
                        <!--<input  name="file" id='upload_img2'  type="file">-->
                        <input type="hidden" name="cardImgF" id='cardImgF' value="{$data.cardImgF}"  readonly="readonly" >
                        <span>
                        <a href="javascript:dsLayerOpen('{:url('Fupersonalshiming/datu',['img'=>$data.cardImgF])}','原图')">查看原图
                        </a></span>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_cardImgs}:</td>
                    <td class="vatop rowform">
                        <img src="{$data.cardImgS}" width="150"/>
                        <!--<input  name="file" id='upload_img3'  type="file">-->
                        <input type="hidden" name="cardImgS" id='cardImgS' value="{$data.cardImgS}" readonly="readonly" >
                        <span>
                        <a href="javascript:dsLayerOpen('{:url('Fupersonalshiming/datu',['img'=>$data.cardImgS])}','原图')">查看原图
                        </a></span>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_learning}:</td>
                    <td class="vatop rowform"><textarea type="text" value="" name="learning" id="learning" readonly="readonly" >{$data.learning}</textarea></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_work}:</td>
                    <td class="vatop rowform"><textarea type="text" value="" name="work" id="work" class="txt" readonly="readonly" >{$data.work}</textarea></td>
                    <td class="vatop tips"></td>
                </tr>
                {if $data.cardstatus==2}
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_cardstatus}:</td>
                    <td class="vatop rowform">
                        <!--<input type="radio" value="1" name="cardstatus"  {if $data.cardstatus==1} checked{/if}>认证成功-->
                        <input type="radio" value="2" name="cardstatus" {if $data.cardstatus==2} checked{/if}>认证失败
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_cardfail_resonse}:</td>
                    <td class="vatop rowform">
                        <textarea name="cardfail_resonse" readonly="readonly" >{$data.cardfail_resonse}</textarea>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                {/if}
                {if $data.cardstatus==3}
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_cardstatus}:</td>
                    <td class="vatop rowform">
                        <input type="radio" value="1" name="cardstatus"  {if $data.cardstatus==3} checked{/if}>已提交信息等待认证
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                {/if}
                {if $data.cardstatus==1}
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_cardstatus}:</td>
                    <td class="vatop rowform">
                        <input type="radio" value="1" name="cardstatus"  {if $data.cardstatus==1} checked{/if}>认证成功
                        <!--<input type="radio" value="2" name="cardstatus" {if $data.cardstatus==2} checked{/if}>认证失败-->
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                {/if}
                {if $data.cardstatus==0}
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_cardstatus}:</td>
                    <td class="vatop rowform">
                        <input type="radio" value="1" name="cardstatus"  {if $data.cardstatus==0} checked{/if}>未认证
                        <!--<input type="radio" value="2" name="cardstatus" {if $data.cardstatus==2} checked{/if}>认证失败-->
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                {/if}
                <tr class="noborder">
                    <td class="required w120">{$Think.lang.fuwu_personal_gradeid}:</td>
                    <td class="vatop rowform">
                        <select name="gradeid" id="gradeid">
                            {foreach name='gradeArr' item='v'}
                            {if $data.gradeid== $v.id}
                            <option value="{$v.id}"  selected>{$v.name}</option>
                            {/if}
                            {/foreach}
                        </select>
                    </td>
                    <td class="vatop tips"></td>
                </tr>

                <tr class="noborder">
                    <td class="required w120"><label>{$Think.lang.fuwu_personal_status}: </label></td>
                    <td class="vatop rowform onoff">
                        {if $data.status == '1'}
                        <label for="status1" class="cb-enable selected" title="{$Think.lang.fuwu_personal_status1}"><span>{$Think.lang.fuwu_personal_status1}</span></label>
                        {/if}
                        {if $data.status == '0'}
                        <label for="status0" class="cb-disable selected" title="{$Think.lang.fuwu_personal_status0}"><span>{$Think.lang.fuwu_personal_status0}</span></label>
                        {/if}
                        <input id="status1" name="status" {if $data.status == '1'}checked="checked"{/if} value="1" type="radio">
                        <input id="status0" name="status" {if $data.status == '0'}checked="checked"{/if} value="0" type="radio">
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label>{$Think.lang.fuwu_personal_admin_name}: </label></td>
                    <td class="vatop rowform"><input type="text" value="{$data.admin_name}" name="admin_name" id="admin_name" class="txt" readonly="readonly"></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label>{$Think.lang.fuwu_personal_createdtime}: </label></td>
                    <td class="vatop rowform"><input type="text" value="{$data.created_at}" name="created_at" id="created_at" class="txt" readonly="readonly" ></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label>{$Think.lang.fuwu_personal_updatedtime}: </label></td>
                    <td class="vatop rowform"><input type="text" value="{$data.updated_at}" name="updated_at" id="updated_at" class="txt" readonly="readonly" ></td>
                    <td class="vatop tips"></td>
                </tr>

                </tbody>
                <tfoot>
                <tr class="tfoot">
                    <td colspan="15" >
                        <a class="btn" href="{:url('Fupersonal/index')}" title="返回">
                            <span>返回</span></a>
                    </td>
                </tr>
                </tfoot>
            </table>
        </form>
    </div>
<script src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js"></script>
<link rel="stylesheet" href="{$Think.CHAT_SITE_URL}/css/chat.css">
<script>
    $(function () {
        $("#address").ds_region();
        $('#birthday').datepicker({dateFormat: 'yy-mm-dd',birthday: '{$data.birthday}'});
    })
//按钮先执行验证再提交表
    $(document).ready(function () {
        $("#form").validate({
        errorPlacement: function (error,element) {
                error.appendTo(element.parent().parent().find('td:last'));
            },
            rules:{
                skillid:{
                  required:true
                },
                phone:{
                    required:true,
                    checkphone:true,
                    remote:{
                        url: ADMINSITEURL+'/Fupersonal/ajax.html?branch=check_phone',
                        type:'get',
                        data:{
                            phone:function () {
                                return $('#phone').val();
                            },
                            id:function () {
                                return $('#id').val();
                            }
                        }
                    }
                },
                password:{
                    required:true,
                    minlength:6
                },
                quren_password:{
                    required:true,
                    equalTo:"#password"
                },
            },
            messages:{
                skillid:{
                    required:'{$Think.lang.fuwu_personal_skillid_bi}',
                },
                phone:{
                    required:'{$Think.lang.fuwu_personal_phone_bi}',
                    remote:'{$Think.lang.fuwu_personal_phone_unique}',

                },
                password:{
                    required:'{$Think.lang.fuwu_personal_password_bi}',
                    minlength:'{$Think.lang.fuwu_personal_password_min}',
                },
                quren_password:{
                    required:'{$Think.lang.fuwu_personal_quren_password_bi}',
                    equalTo:'{$Think.lang.fuwu_personal_quren_password_tong}',
                },
            }
        });
        //自定义正则表达示验证方法
        $.validator.addMethod("checkphone",function(value,element,params){
            var checkQQ = /^[1][3,4,5,7,8,9][0-9]{9}$/;
            return this.optional(element)||(checkQQ.test(value));
        },"{$Think.lang.fuwu_personal_phone_geshi}");
    });
$(document).on('change','#upload_img',function() {
    var files = document.getElementById('upload_img').files[0];
    var formData = new FormData();
    formData.append('file',files);
    layer.msg('正在上传，请稍后');
    $.ajax({
        //请求方式
        type : "POST",
        //请求地址
        url : "ajax_upload",
        data : formData,
        cache:false,  //默认是true，但是一般不做缓存
        processData:false, //用于对data参数进行序列化处理，这里必须false；如果是true，就会将FormData转换为String类型
        contentType:false,  //一些文件上传http协议的关系，自行百度，如果上传的有文件，那么只能设置为false
        //请求成功
        success : function(result) {
            if(result.err==0){
                layer.msg(result.msg);
                $('#avtar').val(result.data);
            }else{
                $('#avtar').val('');
                alert('文件信息错误,请重新上传');return false;
            }



        },
        //请求失败，包含具体的错误信息
        error : function(e){
            console.log(e.status);
            console.log(e.responseText);
        }
    });

});
</script>